/**
 * @program: FindFileDemo
 * @author: Ding Houwen
 * @create: 2019-08-01 13:05
 **/

package com.example.findfiledemo.controller;

import com.example.findfiledemo.entiy.FileEntiy;
import com.example.findfiledemo.service.AnyQService;
import com.example.findfiledemo.service.FileService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Api(value = "FileFindController", description = "文件查找Controller")
@RestController
@RequestMapping("/filefind")
@CrossOrigin(allowedHeaders = "*", allowCredentials = "true")
public class FileFindController {
    @Autowired
    private FileService fileService;
    @Autowired
    private AnyQService anyQService;

    @ApiOperation(value = "匹配标题和正文搜索", notes = "对word、Excel、pdf、txt、PPT的文件名和文件内容进行搜索")
    @RequestMapping(value = "/findfile", method = RequestMethod.POST)
    @ApiImplicitParam(name = "name", value = "关键字", dataType = "String", paramType = "query", required = true)
    public List<FileEntiy> FindFile(String name) {
        return fileService.FindFile(name);
    }

    @ApiOperation(value = "通过文件ID查询文件正文", notes = "过文件ID查询文件正文 返回String字符串")
    @RequestMapping(value = "/finddetails", method = RequestMethod.POST)
    @ApiImplicitParam(name = "fileid", value = "文件ID", dataType = "int", paramType = "query", required = true)
    public String FindDetailsById(int fileid) {
        return fileService.FindDetailsById(fileid);
    }



/**
 @ApiOperation(value = "匹配文件名搜索", notes = "对word、Excel、pdf文件名进行搜索")
 @RequestMapping(value = "/findFilebyname", method = RequestMethod.POST)
 @ApiImplicitParam(name = "name", value = "关键字", dataType = "String", paramType = "query",required = true)
 public List<FileEntiy> FindFileByName(String name) {
 return fileService.FindFileByName(name);
 }

 @ApiOperation(value = "匹配文件正文搜索", notes = "对word、Excel、pdf的文件内容进行搜索")
 @RequestMapping(value = "/findfilebydetails", method = RequestMethod.POST)
 @ApiImplicitParam(name = "name", value = "关键字", dataType = "String", paramType = "query",required = true)
 public List<FileEntiy> FindFileByDetails(String name) {
 return fileService.FindFileByDetails(name);
 }
 **/


}

